<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>知识</title>
    <%@include file="/common/commonCSS.jsp" %>
    <%@include file="/common/commonJS.jsp" %>
    <%@include file="/WEB-INF/jsp/include/taglib.jsp" %>
</head>

<body>
    <div class="main-container" id="main-container">

        <div class="row" style="margin-top: 20px;">
            <div class="col-md-12">
                <form class="layui-form" id="search-from" action="${webRoot}/knowledge/list">
                    <div class="layui-form-item">
                        <%--<label class="layui-form-label" style="width:6%;">标题:</label>--%>
                        <div class="layui-input-inline">
                            <input type="text" name="topic" value="${knowledge.topic}"  placeholder="请输入标题"  class="layui-input" >
                        </div>
                        <button class="layui-btn" id="searchSubmit"><i class="layui-icon">&#xe615;</i>搜 索</button>
                        <button class="layui-btn layui-btn-normal" type="button" id="refresh"><i class="layui-icon">&#x1005;</i>重 置</button>
                        <a class="layui-btn" href="${webRoot}/knowledge/info"><i class="layui-icon">&#xe61f;</i> 新 增</a>
                    </div>
                </form>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <table id="table-list" class="layui-table" lay-size="sm">
                    <thead>
                        <tr>
                            <th>序号</th>
                            <th>标题</th>
                            <th>工单编号</th>
                            <th>业务系统</th>
                            <th>作者</th>
                            <%--<th>处理人</th>--%>
                            <th>流程状态</th>
                            <th>创建时间</th>
                            <c:forEach items="${fieldList}" var="firld" varStatus="i">
                                <th>${firld.fieldName}</th>
                            </c:forEach>
                            <th>操作</th>

                        </tr>
                    </thead>
                    <tbody>
                        <c:forEach items="${page.result}" var="knowledge" varStatus="i">
                            <tr id="knowledge${knowledge.id }">
                                <td>${i.index+1 }</td>
                                <td>${knowledge.topic}</td>
                                <td>${knowledge.knoNo}</td>
                                <td>${knowledge.operationName}</td>
                                <td>${knowledge.authorUser}</td>
                                <%--<td>${knowledge.dealUsers}</td>--%>
                                <td>${fns:getCodeName("knowledge_status",knowledge.status)}</td>
<%--                                <td><fmt:formatDate value="${knowledge.createDate}" pattern="yyyy-MM-dd hh:mm:ss"/></td>--%>
                                <td>${knowledge.createDate}</td>
                                <%--<td>${fns:getCodeName("act_result",knowledge.actResult)}</td>--%>
                                <%--<td>${fns:getCodeName("knowledge_status",knowledge.status)}</td>--%>
                                <c:forEach items="${knowledge.valueDictionarys}" var="valueDictionary">
                                    <td>${valueDictionary.fieldValue}</td>
                                </c:forEach>
                                <td>
                                    <div class=" btn-group ">
                                        <c:if test="${knowledge.status == 0}">
                                            <a class="layui-btn layui-btn-small" title="编辑" href="${webRoot}/knowledge/info?id=${knowledge.id}" ><i class="layui-icon">&#xe642;</i></a>
                                            <button class="layui-btn layui-btn-small" title="提交" type="button" onclick="flowSumbit('knowledge','${knowledge.id}')"><i class="layui-icon">&#xe62f;</i></button>
                                            <button class="layui-btn layui-btn-danger layui-btn-small" title="删除" type="button" onclick="deleteById('${knowledge.id}')"><i class="layui-icon">&#xe640;</i></button>
                                        </c:if>
                                        <c:if test="${(knowledge.status == 1 || knowledge.status == 2 || knowledge.status == 3)}">
                                            <button class="layui-btn layui-btn-small" type="button" title="审批记录" onclick="doTaskTab('knowledge','${knowledge.id}','${knowledge.instanceId}')"><i class="layui-icon">&#xe60e;</i></button>
                                            <button class="layui-btn layui-btn-small layui-btn-warm" type="button" title="查看流程图" onclick="showFlowImg('${knowledge.instanceId}')"><i class="layui-icon">&#xe64a;</i></button>
                                        </c:if>
                                        <c:if test="${(knowledge.status == 4 || knowledge.status == 5 || knowledge.status == 6)}">
                                            <button class="layui-btn layui-btn-small" type="button" title="审批记录" onclick="doTaskTab('knowledge','${knowledge.id}','${knowledge.instanceId}')"><i class="layui-icon">&#xe60e;</i></button>
                                            <button class="layui-btn layui-btn-small layui-btn-warm" type="button" title="查看流程图" onclick="showFlowImg('${knowledge.instanceId}')"><i class="layui-icon">&#xe64a;</i></button>
                                        </c:if>
                                        <%--<c:if test="${(knowledge.proStatus == 2 || knowledge.proStatus == 3)}">--%>
                                            <%--<a class="layui-btn layui-btn-small" href="${webRoot}/knowledge/info?id=${knowledge.id}" ><i class="layui-icon">&#xe642;</i>编辑</a>--%>
                                            <%--<button class="layui-btn layui-btn-small" type="button" onclick="flowSumbit('knowledge','${knowledge.id}')"><i class="layui-icon">&#xe604;</i>提交</button>--%>
                                            <%--<button class="layui-btn layui-btn-small" type="button" onclick="doTaskTab('knowledge','${knowledge.id}','${knowledge.instanceId}')"><i class="layui-icon">&#xe705;</i>审批记录</button>--%>
                                            <%--<button class="layui-btn layui-btn-small layui-btn-warm" type="button" onclick="showFlowImg('${knowledge.instanceId}')"><i class="layui-icon">&#xe60d;</i>查看流程图</button>--%>
                                        <%--</c:if>--%>
                                    </div>
                                </td>
                            </tr>
                        </c:forEach>
                    </tbody>
                </table>
                <sys:page page="${page}"></sys:page>
            </div>
        </div>
    </div>
</body>
<script src="${webRoot}/js/activiti/actSumbit.js"></script>
<script>
    function deleteById(id) {
        var url ="${webRoot}/knowledge/delete";
        confirm('确定要删除选中的记录？', function(){
            $.post(url,"id="+id,function (r) {
                if(r.code=='0'){
                    toast(r.msg);
                    $("#knowledge_"+id+"").remove();
                    location.href='${webRoot}/knowledge/list';
                }else {
                    alertMsg(r.msg);
                }
            });
        });
    }
</script>

</html>
